class CreateUserRanks < ActiveRecord::Migration
  def self.up
    create_table :user_ranks do |t|
      t.column :name, :string           # 会员级别名称
      t.column :int_min, :integer       # 会员级别积分下限
      t.column :int_max, :integer       # 会员级别积分上限
      t.column :discount, :integer      # 初始折扣率
      t.column :deleted_at, :datetime
      t.timestamps
    end
    
    # 导入默认数据
    UserRank.import_data
  end

  def self.down
    drop_table :user_ranks
  end
end
